#ifndef H_RIFF
#define H_RIFF
#include <stdint.h>
#include <string.h>

struct RIFF {
	//12 byte riff header
	char chunkid[4]; //"RIFF"
	uint32_t chunksize; //essentially filesize-8 because this value starts counting 8 bytes in
	char format[4]; //this contains the text "WAVE"

	//WAVE chunk.. contains 2 subchunks fmt and data
	char subchunkid[4]; //contains the text "fmt "
	uint32_t subchunksize; //how big the fmt subchunk is ... for PCM this is 16
	uint16_t audioformat; //this is 1 for raw or something else for compressed
	uint16_t channels; //number of channels
	uint32_t hz; //the samplerate
	uint32_t byterate; //SampleRate * NumChannels * BitsPerSample/8
	uint16_t blockalign; //NumChannels * BitsPerSample/8
	uint16_t bps; //bits per sample
	//end fmt unless not PCM

	//data subchunk
	char subchunkid2[4]; //contains text "data"
	uint32_t subchunksize2; //how big the rest of the file is
	//end header...
	//data goes here... but we let the program concatenate this struct to the data

};

typedef struct RIFF RIFF;

#endif
